<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue入门</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="root">
       firstName:<input v-model="firstName"><br/>
       lastName:<input v-model="lastName">
       <div>{{fullName}}</div>
       <div>{{count}}</div>
    </div>
    <script>
        new Vue({
            el: "#root",
            data: {
                firstName:"",
                lastName:"",
                count:0
            },
            computed:{
                fullName: function(){
                    return this.firstName + " " + this.lastName
                }

            },
            watch:{
              firstName: function(){
                  this.count++
              },
              lastName: function(){
                  this.count++
              }  
            }
        })
    </script>
</body>
</html>